/**
 * Copyright &copy; 2015-2020 <a href="https://www.elisoft.com.cn">emlap</a> All rights reserved.
 */
package com.elisoft.emlap.goods.web;

import com.elisoft.emlap.common.Result;
import com.elisoft.emlap.domain.AgentAppGoods;
import com.elisoft.emlap.goods.base.BaseController;
import com.elisoft.emlap.goods.common.Constant;
import com.elisoft.emlap.goods.service.AgentAppGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 代理商销售记录商品信息Controller
 * @author wuyanshen
 * @version 2018-08-22
 */

@RestController
@RequestMapping(value = "/agent/appGoods")
public class AgentAppGoodsController extends BaseController {

	@Autowired
	private AgentAppGoodsService agentAppGoodsService;
	@Autowired
    private Constant constant;


	/**
	 * 获取git中agent-app-goods-test.properties配置文件的version值
     * 测试springCloud的手动刷新配置功能
     * 刷新配置方法：POST方式访问http://localhost:8003/actuator/refresh
	 *
	 * @return java.lang.String
	 * @Date 2018/12/12 10:35 AM
	 * @Author wuyanshen
	 */
    @GetMapping(value = "version")
    public String version() {
		String version = constant.getVersion();
        return version;
    }

    /**
     * 测试Ribbon 集群负载均衡
     *
     * @param
     * @Date 2018/12/12 4:10 PM
     * @Author wuyanshen
     */
    @GetMapping(value = "testRibbon")
    public String testFiggon() {
        String port = constant.getPort();
        return "你访问的服务端口号是："+port;
    }

	@GetMapping(value = "list")
	public Result list() {
        AgentAppGoods agentAppGoods = new AgentAppGoods();
        agentAppGoods.setId("001e46ff8fec490eb55aa17e91234d33");
		List<AgentAppGoods> list = agentAppGoodsService.findList(agentAppGoods);
		return Result.success(list);
	}

}